package com.dataart.training.crimequalification.beans;

import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

public class ConfigurationUtils {

    /**
     * @return
     */
    public boolean isTaskChosen(FacesContext context) {

        HttpSession session = (HttpSession) context.getExternalContext().getSession(true);
        String taskChosenAttr = (String) session.getAttribute("taskChosen");

        if (taskChosenAttr == null || taskChosenAttr.equals("false")) {
            return false;
        }

        return true;

    }

    /**
     * @param taskChosen
     */
    public void setTaskChosen(boolean taskChosen, FacesContext context) {

        HttpSession session = (HttpSession) context.getExternalContext().getSession(true);
        session.setAttribute("taskChosen", String.valueOf(taskChosen));

    }
}
